import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

public class Java007 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str1 =sc.nextLine();//[0-9] [a-z][A-Z]
        String str2 =sc.nextLine();
        String regex = "^[0-9a-zA-Z]+$";
        if(str1.matches(regex)&&str2.matches(regex)){
            fun(str1,str2);
        }else{
            System.out.println("请输入正确的字符串");
        }
    }
    public static void fun(String str1, String str2){
        HashMap<Character,Integer> map = new HashMap<>();

        ArrayList<Character> c1=new ArrayList<>();
        for(Character c:str1.toCharArray()){
            c1.add(c);
        }
        ArrayList<Character> c2=new ArrayList<>();
        for(Character c:str2.toCharArray()){
            c2.add(c);
        }

        Map<Character, Long> map1 = c1.stream().collect(Collectors.groupingBy(s->s,Collectors.counting()));
        Map<Character, Long> map2 = c2.stream().collect(Collectors.groupingBy(s->s,Collectors.counting()));


        map1.forEach((key,value)->map2.merge(key,value,(v1,v2)->v1-v1));


        boolean flag1=map1.entrySet().stream().allMatch(s->map1.getOrDefault(s.getKey(),0L)>=map2.getOrDefault(s.getKey(),0L));
        boolean flag2=map2.entrySet().stream().allMatch(s->map1.getOrDefault(s.getKey(),0L)>=map2.getOrDefault(s.getKey(),0L));


        //引用




       if(flag1&&flag2){
           System.out.println("YES");
           System.out.println(str1.length()-str2.length());
       }else {
           System.out.println("NO");
       }
    }
}
